package com.chaosj.skill.webservice.config

import com.chaosj.skill.webservice.IWebService

/**
 * @Description:
 * @author caoyangjie
 * @date 2020年05月2020/5/12日 09:03
 * @Copyright: © 赢时胜
 */
@Configuration
class CxfConfig {
    @Bean
    public ServletRegistrationBean dispatcherServlet() {
        return new ServletRegistrationBean(new CXFServlet(), "/OceanFax/svc/ows/*","/TraFaxWebService/*");
//        return new ServletRegistrationBean(new CXFServlet(), "/services/*");
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    //把实现类交给spring管理
    @Bean
    public IWebService appService() {
        return new AppServiceImpl();
    }

    //终端路径
    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), appService());
        //添加校验拦截器
        endpoint.getInInterceptors().add(new AuthInterceptor());
        endpoint.publish("/oceanfaxservice.asmx");
        return endpoint;
    }
}
